package cn.yaoud.salus.oms.alarm.util;

import java.io.PrintWriter;
import java.io.StringWriter;

/**
 * @author 唐彪
 */
public class StackTraceUtil {
    /**
     * 堆栈信息转字符串
     *
     * @param t 异常
     * @return 堆栈信息
     */
    public static String printStackTraceToString(Throwable t) {
        StringWriter sw = new StringWriter();
        t.printStackTrace(new PrintWriter(sw, true));
        return sw.getBuffer().toString();
    }
}
